package com.yfqy.admin.domain.mapper;

import com.yfqy.admin.domain.entity.SysUserRole;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SysUserRoleMapper {
    int deleteByPrimaryKey(Long id);

    int insert(SysUserRole record);

    int insertSelective(SysUserRole record);

    SysUserRole selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysUserRole record);

    int updateByPrimaryKey(SysUserRole record);

    /**
     * 删除用的全部角色
     */
    void deleteUserRolesWithModifyUser(@Param("userId") Long userId, @Param("modifyUser") Long modifyUser);

    /**
     * 删除用户的部分角色
     */
    void deletePartUserRolesWithModifyUser(@Param("userId") Long userId, @Param("modifyUser") Long modifyUser, @Param("roleIdsByUserId") List<Long> roleIdsByUserId);

    List<Long> selectUserRoleIds(@Param("userId") Long userId);

    void addRolesToUser(@Param("userId") Long userId, @Param("roleIds") List<Long> validRoleIds, @Param("createdBy") Long createdBy);

    void updateUserRolesByRoleId(@Param("roleId") Long roleId, @Param("status") Byte status, @Param("modifiedBy") Long modifiedBy);

    List<Long> selectUserIdsByRoleId(@Param("roleId") Long roleId);

    List<Long> selectUserIdsByRoleIds(@Param("roleIds") List<Long> roleIds);
}